<?php

namespace App\Listeners;

use App\Events\SomeEvent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SomeEventListener implements  ShouldQueue
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  SomeEvent  $event
     * @return void
     */
    public function handle(SomeEvent $event)
    {
         echo date('Y-m-d H:i:s',time())."\n";
         $post=$event->user;
         \Log::info('保存产品信息到缓存成功！',['time'=>date('Y-m-d H:i:s',time()),'id'=>$post->id]);
    }
    public function failed(SomeEvent $event, $exception)
    {
        \Log::info('事件队列处理异常',['event'=>$event,'exception'=>$exception]);
    }
}
